package com.ymatou.iapi.login.testcase;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonObject;
import com.ymatou.iapi.auth.parameter.SignAuthBean;
import com.ymatou.iapi.login.parameter.ThirdpartyLoginBean;
import com.ymatou.iapi.login.parameter.UnBindThirdPartyAccountDtoBean;
import com.ymatou.iapi.login.parameter.WeiXinUserRequestDtoBean;
import com.ymatou.iapi.login.parameter.ThirdpartyLoginBean;
import com.ymatou.iapi.login.service.ThirdpartyLoginCall;
import com.ymatou.iapi.login.service.WeiXinUserRequestDtoCall;
import com.ymatou.iapi.userregister.parameter.UserRegisterInfoRequestDtoBean;
import com.ymatou.iapi.userregister.service.UserRegisterInfoRequestDtoCall;
import com.ymatou.iapi.userservice.parameter.enums.AppSourceEnum;
import com.ymatou.iapi.userservice.parameter.enums.TerminalSourceEnum;
import com.ymatou.iapi.userservice.parameter.enums.ThirdPartyTypeEnum;
import com.ymatou.iapi.userservice.parameter.req.BindThirdPartyUserReq;
import com.ymatou.iapi.userservice.parameter.req.CreateUserReq;
import com.ymatou.iapi.userservice.parameter.req.UnBindThirdPartyUserReq;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.AuthCallServiceV2;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.database.model.LoginLog;
import com.ymttest.database.model.ThirdpartyUserbind;
import com.ymttest.database.model.ThirdpartyUserbindHistory;
import com.ymttest.database.model.Userinfoex;
import com.ymttest.database.sqlwapper.JUserWapper;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.constant.AppTypeChannel;
import com.ymttest.utils.constant.ECode;
/**
*第三方联合登录
*FreeMaker Template自动生成代码
*/


@TestSuite
public class Ts_ThirdpartyLogin {
	private static ThirdpartyLoginBean loginBean;
	private static ThirdpartyLoginCall loginCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("第三方联合登录");
	}

	@Before
	public void caseUp() {
		loginBean = new ThirdpartyLoginBean();
		loginCall = new ThirdpartyLoginCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(loginCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	private void verifyDBBind(Integer uid, ThirdpartyLoginBean cq) {
		// TODO 需要检查字段
		JUserWapper ju = new JUserWapper();

		Logger.comment("验证thirdparty_userbind");
		ThirdpartyUserbind thirdinfo = ju.selectthirdpartyuserbind(uid).get(0);
		Logger.verifyEquals(cq.getThirdPartyId(), thirdinfo.getThirdPartyId(), "验证ThirdPartyId");
		Logger.verifyEquals(ThirdPartyTypeEnum.QQ.getCode(), thirdinfo.getThirdPartyType(), "验证ThirdPartyType");
	}

	private void verifyDB(Integer uid, ThirdpartyLoginBean cq) {
		// TODO 需要检查字段
		JUserWapper ju = new JUserWapper();
		if (cq.getDid().equals("testChannelSource")) {
			Userinfoex ex = ju.selectUserinfoexByUid(uid).get(0);
			Logger.verifyEquals(cq.getThirdPartyType().getCode(), ex.getChannelSource(), "验证ChannelSource");
		}

		Logger.comment("验证thirdparty_userbind");
		ThirdpartyUserbind thirdinfo = ju.selectthirdpartyuserbind(uid).get(0);
		Logger.verifyEquals(cq.getThirdPartyId(), thirdinfo.getThirdPartyId(), "验证ThirdPartyId");
		Logger.verifyEquals(cq.getThirdPartyType().getCode(), thirdinfo.getThirdPartyType(), "验证ThirdPartyType");

		Logger.comment("验证thirdparty_userbind_history");
		ThirdpartyUserbindHistory thirdinfohist = ju.selectthirdpartyuserbindhistory(uid).get(0);
		Logger.verifyEquals(true, thirdinfohist.getBinding(), "验证binding状态");
		Logger.verifyEquals(cq.getAppSource().getCode(), thirdinfohist.getAppSource(), "验证AppSource");
		Logger.verifyEquals(cq.getClientIp(), thirdinfohist.getClientIp(), "验证ClientIp");
		Logger.verifyEquals(cq.getDeviceId(), thirdinfohist.getDeviceId(), "验证DeviceId");
		Logger.verifyEquals(cq.getMail(), thirdinfohist.getEmail(), "验证Email");
		Logger.verifyEquals(cq.getDid(), thirdinfohist.getEquimentid(), "验证Equimentid");
		Logger.verifyEquals(cq.getMobile(), thirdinfohist.getLoginMobile(), "验证LoginMobile");
		Logger.verifyEquals(cq.getTerminalSource().getCode(), thirdinfohist.getTerminalSource(), "验证TerminalSource");
		Logger.verifyEquals(cq.getThirdPartyType().getCode(), thirdinfohist.getThirdPartyType(), "验证ThirdParty");
		// Global 不修改ThirdpartyUserbindHistory 会出现不同的uid登入的情况
		if (!cq.getAppSource().toString().toLowerCase().contains("global")) {
			Logger.verifyEquals(cq.getThirdPartyId(), thirdinfohist.getThirdPartyId(), "验证ThirdPartyId");
		}
		if (cq.getThirdPartyUserName() == null) {
			Logger.verifyIsContains(".qq", thirdinfohist.getThirdPartyUserName(), "验证ThirdPartyUserName");
		} else {
			Logger.verifyEquals(cq.getThirdPartyUserName(), thirdinfohist.getThirdPartyUserName(),
					"验证ThirdPartyUserName");
		}
	}

//	1.第三方联合登入时传入新的第三方账号且传入手机号为新用户,注册第三方成功

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_001() {
		Logger.start(true, "QQ账号第一次授权,创建用户成功");
		try {
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");
			loginBean = JUserCallService.initLoginBean();
			loginBean.setClientPort("777");
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
			LoginLog loginLog = new JUserWapper().selectLastLoginLogByUid(uid).get(0);
			Logger.debug(FormatUtil.beanToGSONString(loginLog));
			Logger.verifyEquals(loginBean.getClientPort(), loginLog.getClientPort(), "验证LoginLog表中getClientPort");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

//	2.第三方联合登入时传入新的第三方账号且传入手机号为码头已存在用户,这个用户没有绑定过对应第三方账号,绑定成功
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_002() {
		Logger.start(true, "第三方联合登入时传入新的第三方账号且传入手机号为码头已存在用户,这个用户没有绑定过对应第三方账号,绑定成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);

			loginBean = JUserCallService.initLoginBean();
			loginBean.setMobile(cur.getMobile());

			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals("login", loginCall.getResult().get("Remark"), "验证Remark信息");
			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");

			verifyDBBind(uid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

//	3.第三方联合登入时传入新的第三方账号且传入手机号为码头已存在用户,这个用户绑定过对应第三方账号,失败
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_003() {
		Logger.start(true, "第三方联合登入时传入新的第三方账号且传入手机号为码头已存在用户,这个用户绑定过对应第三方账号,失败");
		try {
			CreateUserReq cur = new CreateUserReq();

			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);

			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			BindThirdPartyUserReq third = JUserCallService.initBindThirdUserReq(uid);
			third.setThirdPartyType(ThirdPartyTypeEnum.QQ);

			JUserCallService.bindThirdPartyUserCall(third);

			loginBean = JUserCallService.initLoginBean();
			loginBean.setMobile(cur.getMobile());

			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyIsContains("该手机号码已经绑定过QQ了，换一个试试吧~", loginCall.getString("LastErrorMessage"),
					"验证返回的LastErrorMessage信息");
			Logger.verifyEquals("400", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证是否成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

//	4.三方联合登入时传入已存在未解绑第三方账号,码头用户手机为空,来源为WAP,需要绑定手机
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_004() {
		Logger.start(true, "三方联合登入时传入已存在未解绑第三方账号,码头用户手机为空,来源为WAP,需要绑定手机");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			cur.setMobile(null);
			int uid = JUserCallService.createUserCall(cur);
			String aliUserId = "QQ_" + TestDataManager.getRandomNum(10);
			BindThirdPartyUserReq third = JUserCallService.initBindThirdUserReq(uid);
			third.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			JUserCallService.bindThirdPartyUserCall(third);

			loginBean = JUserCallService.initLoginBean();

			loginBean.setThirdPartyId(aliUserId);
			loginBean.setAppSource(AppSourceEnum.Wap);

			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyIsContains("为了您的账户安全，请绑定你的手机号码", loginCall.getString("LastErrorMessage"),
					"验证返回的LastErrorMessage信息");
			Logger.verifyEquals("400", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证是否成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

//	5.三方联合登入时传入已存在未解绑第三方账号,码头用户手机为空,来源为非WAP(app),登入成功
	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	// 都需要手机号
	public void Tc_ThirdpartyLogin_005() {
		Logger.start(true, "三方联合登入时传入已存在未解绑第三方账号,码头用户手机为空,来源为非WAP(app),登入成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
//			cur.setMobile(null);
			int uid = JUserCallService.createUserCall(cur);
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			BindThirdPartyUserReq third = JUserCallService.initBindThirdUserReq(uid);
			third.setThirdPartyId(aliUserId);
			third.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			JUserCallService.bindThirdPartyUserCall(third);

			loginBean = JUserCallService.initLoginBean();

			loginBean.setThirdPartyId(aliUserId);

			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyIsContains("登录成功", loginCall.getString("SuccessMessage"), "验证返回的SuccessMessage信息");
			Logger.verifyEquals("200", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

//	6.三方联合登入时传入已存在未解绑第三方账号,码头用户手机和传入手机号一致,登入成功
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_006() {
		Logger.start(true, "三方联合登入时传入已存在未解绑第三方账号,码头用户手机和传入手机号一致,登入成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			BindThirdPartyUserReq third = JUserCallService.initBindThirdUserReq(uid);
			third.setThirdPartyId(aliUserId);
			third.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			JUserCallService.bindThirdPartyUserCall(third);

			loginBean = JUserCallService.initLoginBean();

			loginBean.setMobile(cur.getMobile());
			loginBean.setThirdPartyId(aliUserId);

			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyIsContains("登录成功", loginCall.getString("SuccessMessage"), "验证返回的SuccessMessage信息");
			Logger.verifyEquals("200", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

//	7.三方联合登入时传入已存在未解绑第三方账号,码头用户手机为空,第三方传入新手机号,绑定登入成功
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_007() {
		Logger.start(true, "三方联合登入时传入已存在未解绑第三方账号,码头用户手机为空,第三方传入新手机号,绑定登入成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			cur.setMobile(null);
			int uid = JUserCallService.createUserCall(cur);
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			BindThirdPartyUserReq third = JUserCallService.initBindThirdUserReq(uid);
			third.setThirdPartyId(aliUserId);
			third.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			JUserCallService.bindThirdPartyUserCall(third);

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			loginBean.setMobile(TestDataManager.getPhoneNum());
			loginBean.setThirdPartyId(aliUserId);

			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyIsContains("登录成功", loginCall.getString("SuccessMessage"), "验证返回的SuccessMessage信息");
			Logger.verifyEquals("200", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

//	8.三方联合登入时传入已存在未解绑第三方账号,码头用户手机为空,第三方传入手机号是已存在码头用户,失败
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_008() {
		Logger.start(true, "三方联合登入时传入已存在未解绑第三方账号,码头用户手机为空,第三方传入手机号是已存在码头用户,失败");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			cur.setMobile(null);
			int uid = JUserCallService.createUserCall(cur);
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			BindThirdPartyUserReq third = JUserCallService.initBindThirdUserReq(uid);
			third.setThirdPartyId(aliUserId);
			third.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			JUserCallService.bindThirdPartyUserCall(third);

			CreateUserReq cur2 = new CreateUserReq();
			cur2 = JUserCallService.initCreateUserBean(cur2);
			JUserCallService.createUserCall(cur2);

			loginBean = JUserCallService.initLoginBean();
			loginBean.setMobile(cur2.getMobile());
			loginBean.setThirdPartyId(aliUserId);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyIsContains("该手机号码已经绑定过码头账号了，换一个试试吧~", loginCall.getString("LastErrorMessage"),
					"验证返回的LastErrorMessage信息");
			Logger.verifyEquals("400", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证是否成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

//	9.三方联合登入时传入已存在已解绑第三方账号,第三方手机号是新手机,注册登入成功
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_009() {
		Logger.start(true, "三方联合登入时传入已存在已解绑第三方账号,第三方手机号是新手机,注册登入成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			BindThirdPartyUserReq third = JUserCallService.initBindThirdUserReq(uid);
			third.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			JUserCallService.bindThirdPartyUserCall(third);
			UnBindThirdPartyUserReq ubtrd = new UnBindThirdPartyUserReq();
			ubtrd.setThirdPartyId(third.getThirdPartyId());
			ubtrd.setUserId(uid);
			ubtrd.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			JUserCallService.UnBindThirdPartyUserCall(ubtrd);

			loginBean = JUserCallService.initLoginBean();

			loginBean.setMobile(TestDataManager.getPhoneNum());
			loginBean.setThirdPartyId(aliUserId);

			loginCall.setData(loginBean);
			loginCall.callService();

			int nuid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			Logger.verifyEquals("new", loginCall.getResult().get("Remark"), "验证Remark信息");
			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");

			verifyDBBind(nuid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

//	10.三方联合登入时传入已存在已解绑第三方账号,第三方手机号是码头已存在未绑定第三方手机号,绑定成功
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_010() {
		// 绑定解绑再绑定
		Logger.start(true, "三方联合登入时传入已存在已解绑第三方账号,第三方手机号是码头已存在未绑定第三方手机号,绑定成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			BindThirdPartyUserReq third = JUserCallService.initBindThirdUserReq(uid);
			third.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			JUserCallService.bindThirdPartyUserCall(third);
			UnBindThirdPartyUserReq ubtrd = new UnBindThirdPartyUserReq();
			ubtrd.setThirdPartyId(third.getThirdPartyId());
			ubtrd.setUserId(uid);
			ubtrd.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			JUserCallService.UnBindThirdPartyUserCall(ubtrd);

			loginBean = JUserCallService.initLoginBean();

			loginBean.setMobile(cur.getMobile());
			loginBean.setThirdPartyId(aliUserId);

			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals("登录成功", loginCall.getString("SuccessMessage"), "验证返回的Message信息");
			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");

			verifyDBBind(uid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
//	11.三方联合登入时传入已存在已解绑第三方账号,第三方手机号是码头已存在已绑定第三方手机号,失败

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_011() {
		Logger.start(true, "三方联合登入时传入已存在已解绑第三方账号,第三方手机号是码头已存在已绑定第三方手机号,失败");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			BindThirdPartyUserReq third = JUserCallService.initBindThirdUserReq(uid);
			third.setThirdPartyType(ThirdPartyTypeEnum.QQ);
			JUserCallService.bindThirdPartyUserCall(third);
			UnBindThirdPartyUserReq ubtrd = new UnBindThirdPartyUserReq();
			ubtrd.setThirdPartyId(third.getThirdPartyId());
			ubtrd.setUserId(uid);
			ubtrd.setThirdPartyType(ThirdPartyTypeEnum.QQ);
			JUserCallService.UnBindThirdPartyUserCall(ubtrd);

			CreateUserReq cur2 = new CreateUserReq();
			cur2 = JUserCallService.initCreateUserBean(cur2);
			int uid2 = JUserCallService.createUserCall(cur2);
			BindThirdPartyUserReq third2 = JUserCallService.initBindThirdUserReq(uid2);
			third2.setThirdPartyType(ThirdPartyTypeEnum.QQ);
			JUserCallService.bindThirdPartyUserCall(third2);

			loginBean = JUserCallService.initLoginBean();

			loginBean.setMobile(cur2.getMobile());
			loginBean.setThirdPartyId(aliUserId);

			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyIsContains("该手机号码已经绑定过QQ了，换一个试试吧~", loginCall.getString("LastErrorMessage"),
					"验证返回的LastErrorMessage信息");
			Logger.verifyEquals("400", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证是否成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

//	12.三方联合登入时传入已存在未解绑第三方账号,码头用户手机不为空第三方手机号为空,登入成功	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_012() {
		Logger.start(true, "三方联合登入时传入已存在未解绑第三方账号,码头用户手机不为空第三方手机号为空,登入成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			BindThirdPartyUserReq third = JUserCallService.initBindThirdUserReq(uid);
			third.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			third.setThirdPartyId(aliUserId);
			JUserCallService.bindThirdPartyUserCall(third);

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			loginBean.setThirdPartyId(aliUserId);

			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals("login", loginCall.getResult().get("Remark"), "验证Remark信息");
			Logger.verifyEquals("200", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_ThirdpartyLogin_013() {
		Logger.start(false, "不输入Ali用户Id，用户创建失败");
		try {
			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(null);

			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals("false", loginCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals(ECode.ERROR400, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyIsContains("错误的请求参数|无效的第三方用户Id", loginCall.getString("LastErrorMessage"), "验证返回的Message信息");
			Logger.verifyEquals("IllegalArgument", loginCall.getResult().get("VerifyCode"), "验证凭据");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_ThirdpartyLogin_014() {
		Logger.start(true, "不输入真实用户名，用户创建成功");
		try {
			loginBean = JUserCallService.initLoginBean();

			loginBean.setThirdPartyUserName(null);
			String phone = TestDataManager.getPhoneNum();
			loginBean.setMobile(phone);

			loginCall.setData(loginBean);
			loginCall.callService();

			int nuid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			Logger.verifyEquals("注册成功", loginCall.getString("SuccessMessage"), "验证返回的Message信息");
			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");

			Logger.verifyEquals("new", loginCall.getResult().get("Remark"), "验证Remark信息");
			Logger.verifyEquals("Success", loginCall.getResult().get("VerifyCode"), "验证凭据");

			verifyDB(nuid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_ThirdpartyLogin_015() {
		Logger.start(false, "不输入手机，用户创建失败");
		try {
			loginBean = JUserCallService.initLoginBean();

			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals("为了您的账户安全，请绑定你的手机号码", loginCall.getString("LastErrorMessage"), "验证返回的Message信息");
			Logger.verifyEquals(ECode.ERROR400, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals("NeedBindMobile", loginCall.getResult().get("VerifyCode"), "验证凭证");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_ThirdpartyLogin_016() {
		Logger.start(true, "QQ账号第一次授权,创建用户成功,用户名长度大于20");
		try {
			loginBean = JUserCallService.initLoginBean();

			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");
			loginBean.setThirdPartyUserName("regAliUser_" + TestDataManager.getRandomNum(20));
			loginBean.setMobile(phone);

			loginCall.setData(loginBean);
			loginCall.callService();
			Logger.verifyEquals("new", loginCall.getResult().get("Remark"), "验证Remark信息");
			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_ThirdpartyLogin_017() {
		Logger.start(false, "QQ账号第一次授权,创建用户失败,用户名长度大于100");
		try {
			String aliUserId = "ali_" + TestDataManager.getRandomNum(181);

			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");
			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(aliUserId);
			loginBean.setMobile(phone);

			loginCall.setData(loginBean);
			loginCall.callService();
			String VerifyCode = loginCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode")
					.getAsString();
			Logger.verifyEquals("IllegalArgument", VerifyCode, "验证返回的LoginNameLengthError信息");
			Logger.verifyEquals("400", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证是否成功");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_018() {
		Logger.start(true, "传入TokenSource为sellerapp用户注册成功JIRACONN-2123");
		try {
			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");

			loginBean = JUserCallService.initLoginBean();
			loginBean.setMobile(phone);
			loginBean.setTokenSource("sellerapp");

			loginCall.setData(loginBean);
			loginCall.callService();
			Logger.verifyEquals("注册成功", loginCall.getString("SuccessMessage"), "验证返回的Message信息");
			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_019() {
		Logger.start(true, "传入TokenSource为app用户注册成功JIRACONN-2123");
		try {
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);

			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");

			loginBean = JUserCallService.initLoginBean();

			loginBean.setMobile(phone);
			loginBean.setTokenSource("app");
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals("注册成功", loginCall.getString("SuccessMessage"), "验证返回的Message信息");
			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_020() {
		// 20181011修改 特殊用户自动生成用户名
		Logger.start(false, "特殊字符用户名失败JIRACONN-2522");
		try {

			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");

			loginBean = JUserCallService.initLoginBean();

			loginBean.setThirdPartyUserName("#$%%%");
			loginBean.setMobile(phone);

			loginCall.setData(loginBean);
			loginCall.callService();
			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			int uid = ((Double) loginCall.getResult().get("UserId")).intValue();
			Logger.verifyNotEquals(loginBean.getThirdPartyUserName(), JUserCallService.GetUserInfo(uid).getLoginId(),
					"验证自动生成新名字");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_021() {
		Logger.start(true, "第三方账号已存在，App");
		try {
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");

			loginBean = JUserCallService.initLoginBean();

			loginBean.setMobile(phone);

			loginCall.setData(loginBean);
			loginCall.callService();
			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");

			loginBean.setAppSource(AppSourceEnum.Wap);
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			Logger.comment("和数据库进行数据校验");

			loginBean.setAppSource(AppSourceEnum.App);
			verifyDB(uid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	@Ignore
	// 20181011 不会报错 自动重新生成
	public void Tc_ThirdpartyLogin_022() {
		Logger.start(false, "QQ账号第一次授权,thirdPartyUserName纯数字报错");
		try {
			String aliUserId = TestDataManager.getRandomNum(10);

			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");
			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyUserName(aliUserId);
			loginBean.setMobile(phone);

			loginCall.setData(loginBean);
			loginCall.callService();

			String VerifyCode = loginCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode")
					.getAsString();
			Logger.verifyEquals("LoginNameFullNumberError", VerifyCode, "验证返回的LoginNameLengthError信息");
			Logger.verifyEquals("400", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证返回Success");
			Logger.verifyEquals("登录昵称不能全数字错误", loginCall.getString("LastErrorMessage"), "验证返回LastErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	@Ignore
	// 20181011 不会报错 自动重新生成
	public void Tc_ThirdpartyLogin_023() {
		Logger.start(false, "QQ账号第一次授权,thirdPartyUserName特殊字符");
		try {
			String aliUserId = "@###+" + TestDataManager.getRandomNum(10);

			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");
			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyUserName(aliUserId);
			loginBean.setMobile(phone);

			loginCall.setData(loginBean);
			loginCall.callService();

			String VerifyCode = loginCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode")
					.getAsString();
			Logger.verifyEquals("LoginNameContainSQLSensitiveCode", VerifyCode, "验证返回的LoginNameLengthError信息");
			Logger.verifyEquals("400", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证返回Success");
			Logger.verifyIsContains("敏感字符", loginCall.getString("LastErrorMessage"), "验证返回LastErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	@Ignore
	// 20181011 不会报错 自动重新生成
	public void Tc_ThirdpartyLogin_024() {
		Logger.start(false, "QQ账号第一次授权,thirdPartyUserName_开头");
		try {
			String aliUserId = "_" + TestDataManager.getRandomNum(10);

			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");
			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyUserName(aliUserId);
			loginBean.setMobile(phone);

			loginCall.setData(loginBean);
			loginCall.callService();

			String VerifyCode = loginCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode")
					.getAsString();
			Logger.verifyEquals("LoginNameFistLastError", VerifyCode, "验证返回的LoginNameLengthError信息");
			Logger.verifyEquals("400", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证返回Success");
			Logger.verifyEquals("登录名称（昵称）首末位错误（昵称首位和末位不能是下划线'_'）", loginCall.getString("LastErrorMessage"),
					"验证返回LastErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_025() {
		Logger.start(true, "QQ账号第一次授权,创建用户成功_含中文");
		try {
			String aliUserId = "八哥天才_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");
			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyUserName(aliUserId);
			loginBean.setMobile(phone);

			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_026() {
		Logger.start(true, "WxApp账号第一次授权,创建用户成功");
		try {
			String wapp = "wxapp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.WxApp);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			String AccessToken = loginCall.getJsonObject().get("Result").getAsJsonObject().get("Token").getAsString();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
			SignAuthBean sab = new SignAuthBean();
			sab.setToken(AccessToken);
			sab.setTokenSource("wxapp");
			Map<String, Object> m = AuthCallServiceV2.signAuth(sab);
			Logger.verifyEquals(true, m.get("success"), "验证Success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_027() {
		Logger.start(true, "用户手机注册过WxApp账号授权,登入用户成功");
		try {
			String wapp = "wxapp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			Logger.comment(phone + ":用户注册");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			regbean.setLoginMobile(phone);
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			Integer uid = urrc.getUserid();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.WxApp);
			loginBean.setMobile(phone);
			loginBean.setDid("gotologin");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals("登录成功", loginCall.getString("SuccessMessage"), "验证SuccessMessage");
//			Integer uid=loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_028() {
		Logger.start(true, "用户WxWap注册过WxApp账号授权,不输入手机号登入用户成功");
		try {
			String wapp = "wxapp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			Logger.comment(phone + ":用户WX注册");
			WeiXinUserRequestDtoBean wx = JUserCallService.initWeiXinUserRequestDtoBeanForRegister();
			wx.setMobile(phone);
			WeiXinUserRequestDtoCall urrc = JUserCallService.weiXinUserRequestDto(wx);
			Integer uid = urrc.getUid();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wx.getUnionId());
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.WxApp);
//			loginBean.setMobile(phone);
			loginBean.setDid("gotologin");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals("登录成功", loginCall.getString("SuccessMessage"), "验证SuccessMessage");
//			Integer uid=loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_029() {
		Logger.start(true, "用户WxWap注册过WxApp账号授权,输入正确手机号登入用户成功");
		try {
			String wapp = "wxapp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			Logger.comment(phone + ":用户WX注册");
			WeiXinUserRequestDtoBean wx = JUserCallService.initWeiXinUserRequestDtoBeanForRegister();
			wx.setMobile(phone);
			WeiXinUserRequestDtoCall urrc = JUserCallService.weiXinUserRequestDto(wx);
			Integer uid = urrc.getUid();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wx.getUnionId());
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.WxApp);
			loginBean.setMobile(phone);
			loginBean.setDid("gotologin");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals("登录成功", loginCall.getString("SuccessMessage"), "验证SuccessMessage");
//			Integer uid=loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_030() {
		Logger.start(true, "用户WxWap注册过WxApp账号授权,输入错误手机号登入用户失败");
		try {
			String wapp = "wxapp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			Logger.comment(phone + ":用户WX注册");
			WeiXinUserRequestDtoBean wx = JUserCallService.initWeiXinUserRequestDtoBeanForRegister();
			wx.setMobile(phone);
			WeiXinUserRequestDtoCall urrc = JUserCallService.weiXinUserRequestDto(wx);
			Integer uid = urrc.getUid();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wx.getUnionId());
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.WxApp);
			loginBean.setMobile(phone + 1);
			loginBean.setDid("gotologin");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.ERROR400, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals("当前账号已绑定", loginCall.getString("LastErrorMessage"), "验证LastErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_031() {
		Logger.start(true, "WxApp账号没有绑定手机且是2017年2月1日之前注册的通过登入验证");
		try {
			String wapp = "wxapp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.Wap);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);

			JUserWapper ju = new JUserWapper();
			ju.updateNoMoblie(uid);
			loginBean.setMobile(null);
			loginCall.setData(loginBean);
			loginCall.callService();
			Logger.verifyEquals(ECode.ERROR400, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证是否成功");
			ju.updateRegtime(uid, "2017-01-31");
			loginCall.callService();
			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_032() {
		Logger.start(true, "QQ账号第一次授权,创建用户成功,AppLive11来自码头App直播版本");
		try {
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");
			loginBean = JUserCallService.initLoginBean();
			loginBean.setAppSource(AppSourceEnum.AppLive);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_033() {
		Logger.start(true, "WxApp账号第一次授权,创建用户不输入手机号失败");
		try {
			String wapp = "wxapp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.WxApp);
//			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals("400", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证是否成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_034() {
		Logger.start(true, "GlobalApp账号第一次授权,创建用户成功");
		try {
			String wapp = "GlobalApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalApp);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			String AccessToken = loginCall.getJsonObject().get("Result").getAsJsonObject().get("Token").getAsString();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
			SignAuthBean sab = new SignAuthBean();
			sab.setToken(AccessToken);
			sab.setTokenSource("GlobalApp");
			Map<String, Object> m = AuthCallServiceV2.signAuth(sab);
			Logger.verifyEquals(true, m.get("success"), "验证Success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_035() {
		Logger.start(true, "用户手机注册过GlobalApp账号授权,登入用户成功");
		try {
			String wapp = "GlobalApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			Logger.comment(phone + ":用户注册");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			regbean.setLoginMobile(phone);
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			Integer uid = urrc.getUserid();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalApp);
			loginBean.setMobile(phone);
			loginBean.setDid("gotologin");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals("登录成功", loginCall.getString("SuccessMessage"), "验证SuccessMessage");
//			Integer uid=loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_036() {
		Logger.start(true, "用户WxWap注册过GlobalApp账号授权,不输入手机号登入用户成功");
		try {
			String wapp = "GlobalApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			Logger.comment(phone + ":用户WX注册");
			WeiXinUserRequestDtoBean wx = JUserCallService.initWeiXinUserRequestDtoBeanForRegister();
			wx.setMobile(phone);
			WeiXinUserRequestDtoCall urrc = JUserCallService.weiXinUserRequestDto(wx);
			Integer uid = urrc.getUid();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wx.getUnionId());
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalApp);
//			loginBean.setMobile(phone);
			loginBean.setDid("gotologin");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals("登录成功", loginCall.getString("SuccessMessage"), "验证SuccessMessage");
//			Integer uid=loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_037() {
		Logger.start(true, "用户WxWap注册过GlobalApp账号授权,输入正确手机号登入用户成功");
		try {
			String wapp = "GlobalApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			Logger.comment(phone + ":用户WX注册");
			WeiXinUserRequestDtoBean wx = JUserCallService.initWeiXinUserRequestDtoBeanForRegister();
			wx.setMobile(phone);
			WeiXinUserRequestDtoCall urrc = JUserCallService.weiXinUserRequestDto(wx);
			Integer uid = urrc.getUid();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wx.getUnionId());
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalApp);
			loginBean.setMobile(phone);
			loginBean.setDid("gotologin");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals("登录成功", loginCall.getString("SuccessMessage"), "验证SuccessMessage");
//			Integer uid=loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_038() {
		Logger.start(true, "用户WxWap注册过GlobalApp账号授权,输入错误手机号登入用户失败");
		try {
			String wapp = "GlobalApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			Logger.comment(phone + ":用户WX注册");
			WeiXinUserRequestDtoBean wx = JUserCallService.initWeiXinUserRequestDtoBeanForRegister();
			wx.setMobile(phone);
			WeiXinUserRequestDtoCall urrc = JUserCallService.weiXinUserRequestDto(wx);
			Integer uid = urrc.getUid();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wx.getUnionId());
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalApp);
			loginBean.setMobile(phone + 1);
			loginBean.setDid("gotologin");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.ERROR400, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals("当前账号已绑定", loginCall.getString("LastErrorMessage"), "验证LastErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_039() {
		Logger.start(true, "GlobalApp账号第一次授权,创建用户不输入手机号失败");
		try {
			String wapp = "GlobalApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalApp);
//			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals("400", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证是否成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_040() {
		Logger.start(true, "GlobalWxApp账号第一次授权,创建用户成功");
		try {
			String wapp = "GlobalWxApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalWxApp);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			String AccessToken = loginCall.getJsonObject().get("Result").getAsJsonObject().get("Token").getAsString();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
			SignAuthBean sab = new SignAuthBean();
			sab.setToken(AccessToken);
			sab.setTokenSource("GlobalWxApp");
			Map<String, Object> m = AuthCallServiceV2.signAuth(sab);
			Logger.verifyEquals(true, m.get("success"), "验证Success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_041() {
		Logger.start(true, "用户手机注册过GlobalWxApp账号授权,登入用户成功");
		try {
			String wapp = "GlobalWxApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			Logger.comment(phone + ":用户注册");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			regbean.setLoginMobile(phone);
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			Integer uid = urrc.getUserid();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalWxApp);
			loginBean.setMobile(phone);
			loginBean.setDid("gotologin");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals("登录成功", loginCall.getString("SuccessMessage"), "验证SuccessMessage");
//			Integer uid=loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_042() {
		Logger.start(true, "用户WxWap注册过GlobalWxApp账号授权,不输入手机号登入用户成功");
		try {
			String wapp = "GlobalWxApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			Logger.comment(phone + ":用户WX注册");
			WeiXinUserRequestDtoBean wx = JUserCallService.initWeiXinUserRequestDtoBeanForRegister();
			wx.setMobile(phone);
			WeiXinUserRequestDtoCall urrc = JUserCallService.weiXinUserRequestDto(wx);
			Integer uid = urrc.getUid();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wx.getUnionId());
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalWxApp);
//			loginBean.setMobile(phone);
			loginBean.setDid("gotologin");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals("登录成功", loginCall.getString("SuccessMessage"), "验证SuccessMessage");
//			Integer uid=loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_043() {
		Logger.start(true, "用户WxWap注册过GlobalWxApp账号授权,输入正确手机号登入用户成功");
		try {
			String wapp = "GlobalWxApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			Logger.comment(phone + ":用户WX注册");
			WeiXinUserRequestDtoBean wx = JUserCallService.initWeiXinUserRequestDtoBeanForRegister();
			wx.setMobile(phone);
			WeiXinUserRequestDtoCall urrc = JUserCallService.weiXinUserRequestDto(wx);
			Integer uid = urrc.getUid();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wx.getUnionId());
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalWxApp);
			loginBean.setMobile(phone);
			loginBean.setDid("gotologin");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals("登录成功", loginCall.getString("SuccessMessage"), "验证SuccessMessage");
//			Integer uid=loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_044() {
		Logger.start(true, "用户WxWap注册过GlobalWxApp账号授权,输入错误手机号登入用户失败");
		try {
			String wapp = "GlobalWxApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			Logger.comment(phone + ":用户WX注册");
			WeiXinUserRequestDtoBean wx = JUserCallService.initWeiXinUserRequestDtoBeanForRegister();
			wx.setMobile(phone);
			WeiXinUserRequestDtoCall urrc = JUserCallService.weiXinUserRequestDto(wx);
			Integer uid = urrc.getUid();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wx.getUnionId());
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalWxApp);
			loginBean.setMobile(phone + 1);
			loginBean.setDid("gotologin");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.ERROR400, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals("当前账号已绑定", loginCall.getString("LastErrorMessage"), "验证LastErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_045() {
		Logger.start(true, "GlobalWxApp账号第一次授权,创建用户不输入手机号失败");
		try {
			String wapp = "GlobalWxApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalWxApp);
//			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals("400", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证是否成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_046() {
		Logger.start(true, "GlobalWxApp账号第一次授权,创建用户成功");
		try {
			String wapp = "GlobalWxApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalWxApp);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			// 敏感词会记录在thirdparty_userbind_history userinfo重新生成用户名 -手工验证
			loginBean.setThirdPartyUserName("习近平");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			Logger.verifyEquals("200", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
			JUserWapper ju = new JUserWapper();
			Logger.verifyNotEquals(loginBean.getThirdPartyUserName(), ju.selectUserinfoByUid(uid).get(0).getLoginId(),
					"验证敏感词不会记录成用户名loginid");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_048() {
		Logger.start(true, "GlobalApp账号第一次授权,创建用户成功");
		try {
			String wapp = "GlobalApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalApp);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			Logger.verifyEquals("200", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
			JUserWapper ju = new JUserWapper();
			Logger.verifyEquals(loginBean.getThirdPartyUserName(), ju.selectUserinfoByUid(uid).get(0).getLoginId(),
					"验证用户名loginid");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_049() {
		Logger.start(true, "app账号第一次授权,用户名包含特殊字符,创建用户成功");
		try {
			String wapp = "GlobalApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.App);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginBean.setThirdPartyUserName("云云🔥" + TestDataManager.getRandomNum(8));
			loginCall.setData(loginBean);
			loginCall.callService();
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			Logger.verifyEquals("200", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
			JUserWapper ju = new JUserWapper();
			// 不会落特殊字符-会重命名xxx.weixin
			Logger.verifyNotEquals(loginBean.getThirdPartyUserName(), ju.selectUserinfoByUid(uid).get(0).getLoginId(),
					"验证用户名loginid");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	// 场景变更重新设计
	public void Tc_ThirdpartyLogin_050() {
		// openid相同的时候把他们当做同一个用户
		Logger.start(true, "openid相同,GlobalWxApp账号第一次授权,创建用户成功,然后更换uid再次用一个手机号登入-期望成功更换uid");
		try {
			String wapp = "GlobalWxApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			String openid = "oid_" + TestDataManager.getRandomNum(10);
			loginBean = JUserCallService.initLoginBean();
			loginBean.setOpenId(openid);
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalWxApp);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			String AccessToken = loginCall.getJsonObject().get("Result").getAsJsonObject().get("Token").getAsString();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
			SignAuthBean sab = new SignAuthBean();
			sab.setToken(AccessToken);
			sab.setTokenSource("GlobalWxApp");
			Map<String, Object> m = AuthCallServiceV2.signAuth(sab);
			Logger.verifyEquals(true, m.get("success"), "验证Success");
			loginBean.setThirdPartyUserName("用户名变了");
			loginBean.setThirdPartyId("GlobalWxApp" + TestDataManager.getRandomNum(10));
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			AccessToken = loginCall.getJsonObject().get("Result").getAsJsonObject().get("Token").getAsString();

			Logger.comment("和数据库进行数据校验");
			JUserWapper ju = new JUserWapper();
			if (loginBean.getDid().equals("testChannelSource")) {
				Userinfoex ex = ju.selectUserinfoexByUid(uid).get(0);
				Logger.verifyEquals(loginBean.getThirdPartyType().getCode(), ex.getChannelSource(), "验证ChannelSource");
			}

			Logger.comment("验证thirdparty_userbind");
			ThirdpartyUserbind thirdinfo = ju.selectthirdpartyuserbind(uid).get(0);
			Logger.verifyEquals(loginBean.getThirdPartyId(), thirdinfo.getThirdPartyId(), "验证ThirdPartyId");
			Logger.verifyEquals(loginBean.getThirdPartyType().getCode(), thirdinfo.getThirdPartyType(),
					"验证ThirdPartyType");

			Logger.comment("验证thirdparty_userbind_history");
			ThirdpartyUserbindHistory thirdinfohist = ju.selectthirdpartyuserbindhistory(uid).get(0);
			Logger.verifyEquals(true, thirdinfohist.getBinding(), "验证binding状态");
			Logger.verifyEquals(loginBean.getAppSource().getCode(), thirdinfohist.getAppSource(), "验证AppSource");
			Logger.verifyEquals(loginBean.getThirdPartyUserName(), thirdinfohist.getThirdPartyUserName(),
					"验证ThirdPartyUserName");

			sab = new SignAuthBean();
			sab.setToken(AccessToken);
			sab.setTokenSource("GlobalWxApp");
			m = AuthCallServiceV2.signAuth(sab);
			Logger.verifyEquals(true, m.get("success"), "验证Success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	// 20190814 全球优选更换开放平台 登入的时候遇到ThirdPartyId-unionid 不一致 直接更新
	public void Tc_ThirdpartyLogin_051() {
		// 不同用户
		Logger.start(true, "openid不相同,GlobalWxApp账号第一次授权,创建用户成功,然后更换uid再次用一个手机号登入-期望失败");
		try {
			String wapp = "GlobalWxApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			String openid = "oid_" + TestDataManager.getRandomNum(10);
			loginBean = JUserCallService.initLoginBean();
			loginBean.setOpenId(openid);
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalWxApp);
			loginBean.setThirdPartyId("GlobalWxApp" + TestDataManager.getRandomNum(10));
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			String AccessToken = loginCall.getJsonObject().get("Result").getAsJsonObject().get("Token").getAsString();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);

			SignAuthBean sab = new SignAuthBean();
			sab.setToken(AccessToken);
			sab.setTokenSource("GlobalWxApp");
			Map<String, Object> m = AuthCallServiceV2.signAuth(sab);
			Logger.verifyEquals(true, m.get("success"), "验证Success");

			openid = "oid_" + TestDataManager.getRandomNum(10);
			loginBean.setThirdPartyId("GlobalWxApp" + TestDataManager.getRandomNum(10));
			loginBean.setOpenId(openid);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			AccessToken = loginCall.getJsonObject().get("Result").getAsJsonObject().get("Token").getAsString();

			Logger.comment("和数据库进行数据校验");
			JUserWapper ju = new JUserWapper();
			if (loginBean.getDid().equals("testChannelSource")) {
				Userinfoex ex = ju.selectUserinfoexByUid(uid).get(0);
				Logger.verifyEquals(loginBean.getThirdPartyType().getCode(), ex.getChannelSource(), "验证ChannelSource");
			}

			Logger.comment("验证thirdparty_userbind");
			ThirdpartyUserbind thirdinfo = ju.selectthirdpartyuserbind(uid).get(0);
			Logger.verifyEquals(loginBean.getThirdPartyId(), thirdinfo.getThirdPartyId(), "验证ThirdPartyId");
			Logger.verifyEquals(loginBean.getThirdPartyType().getCode(), thirdinfo.getThirdPartyType(),
					"验证ThirdPartyType");

			Logger.comment("验证thirdparty_userbind_history");
			ThirdpartyUserbindHistory thirdinfohist = ju.selectthirdpartyuserbindhistory(uid).get(0);
			Logger.verifyEquals(true, thirdinfohist.getBinding(), "验证binding状态");
			Logger.verifyEquals(loginBean.getAppSource().getCode(), thirdinfohist.getAppSource(), "验证AppSource");
			Logger.verifyEquals(loginBean.getThirdPartyUserName(), thirdinfohist.getThirdPartyUserName(),
					"验证ThirdPartyUserName");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_052() {
		Logger.start(true, "不同渠道登入允许创建多绑定关系账号");
		try {
			String wapp = "GlobalApp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.Wap);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			Logger.verifyEquals("200", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
			JUserWapper ju = new JUserWapper();
			Logger.verifyEquals(loginBean.getThirdPartyUserName(), ju.selectUserinfoByUid(uid).get(0).getLoginId(),
					"验证用户名loginid");
			loginBean.setAppSource(AppSourceEnum.App);
			loginBean.setThirdPartyId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.callService();
			Logger.verifyEquals("200", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	// 名字小于3位 期望成功-随机量太小 需要手动执行 TODO 解绑
	public void Tc_ThirdpartyLogin_053() {
		Logger.start(true, "WxApp账号第一次授权,创建用户成功第三方用户名小于3位");
		try {
//			String wapp = "wxapp_"+TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId("na4");
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.WxApp);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			String AccessToken = loginCall.getJsonObject().get("Result").getAsJsonObject().get("Token").getAsString();

			JUserCallService.UpdateLoginPwd(uid, "1234abcd");
			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
			UnBindThirdPartyAccountDtoBean cur = JUserCallService.initUnBindThirdPartyAccountDtoBean(
					loginBean.getThirdPartyId(), ThirdPartyTypeEnum.WeiXin.toString(), uid);
			JUserCallService.unBindThirdPartyAccountDto(cur);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_054() {
		Logger.start(true, "GlobalAppFish账号第一次授权,创建用户成功");
		try {
			String wapp = "wxapp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalAppFish);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			String AccessToken = loginCall.getJsonObject().get("Result").getAsJsonObject().get("Token").getAsString();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
			SignAuthBean sab = new SignAuthBean();
			sab.setToken(AccessToken);
			sab.setTokenSource("GlobalAppFish");
			Map<String, Object> m = AuthCallServiceV2.signAuth(sab);
			Logger.verifyEquals(true, m.get("success"), "验证Success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_055() {
		Logger.start(true, "GlobalWxAppFish账号第一次授权,创建用户成功");
		try {
			String wapp = "wxapp_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			loginBean.setAppSource(AppSourceEnum.GlobalWxAppFish);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			String AccessToken = loginCall.getJsonObject().get("Result").getAsJsonObject().get("Token").getAsString();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
			SignAuthBean sab = new SignAuthBean();
			sab.setToken(AccessToken);
			sab.setTokenSource("GlobalWxAppFish");
			Map<String, Object> m = AuthCallServiceV2.signAuth(sab);
			Logger.verifyEquals(true, m.get("success"), "验证Success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_056() {
		Logger.start(true, "抖音账号第一次授权,创建用户成功");
		try {
			String wapp = "dy_" + TestDataManager.getRandomNum(10);
			String phone = "99" + TestDataManager.getRandomIntNum(9);

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.TouTiao);
			loginBean.setAppSource(AppSourceEnum.TouTiaoMiniApp);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			String AccessToken = loginCall.getJsonObject().get("Result").getAsJsonObject().get("Token").getAsString();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
			SignAuthBean sab = new SignAuthBean();
			sab.setToken(AccessToken);
			sab.setTokenSource("TouTiaoMiniApp");
			Map<String, Object> m = AuthCallServiceV2.signAuth(sab);
			Logger.verifyEquals(true, m.get("success"), "验证Success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_057() {
		Logger.start(true, "抖音账号第一次授权,创建用户成功-用户名重复时自动创建toutiao后缀用户名");
		try {
			String wapp = "dy_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyUserName("小鱼儿");
			loginBean.setThirdPartyId(wapp);
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.TouTiao);
			loginBean.setAppSource(AppSourceEnum.TouTiaoMiniApp);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginBean.setOpenId(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			loginCall.setData(loginBean);
			loginCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			String AccessToken = loginCall.getJsonObject().get("Result").getAsJsonObject().get("Token").getAsString();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
			SignAuthBean sab = new SignAuthBean();
			sab.setToken(AccessToken);
			sab.setTokenSource("TouTiaoMiniApp");
			Map<String, Object> m = AuthCallServiceV2.signAuth(sab);
			Logger.verifyEquals(true, m.get("success"), "验证Success");
			Logger.debug(JUserCallService.GetUserInfo(uid).getLoginId());
			Logger.verifyIsContains(".toutiao", JUserCallService.GetUserInfo(uid).getLoginId(), "验证Success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_058() {
		Logger.start(true, "火山TouTiaoHuoShanApp账号第一次授权,创建用户成功");
		try {
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");
			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.HuoShan);
			loginBean.setAppSource(AppSourceEnum.TouTiaoHuoShanApp);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginCall.setData(loginBean);
			loginCall.callService();
			String tid = loginBean.getThirdPartyId();
			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
			loginBean = new ThirdpartyLoginBean();
			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.TouTiao);
			loginBean.setAppSource(AppSourceEnum.TouTiaoMiniApp);
			loginBean.setMobile(phone);
			loginBean.setThirdPartyId(tid);
			loginCall.setData(loginBean);
			loginCall.callService();
			Logger.comment("校验-uid不变");
			Logger.verifyEquals(new BigDecimal(loginCall.getResult().get("UserId").toString()).intValue(), uid, "验证数据");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

//	@Test
//	@Category(P1.class)
//	@TestCase
//	public void Tc_ThirdpartyLogin_059() {
//		Logger.start(true, "苹果账号第一次授权,创建用户成功");
//		try {
//			String aliUserId = "apple_" + TestDataManager.getRandomNum(10);
//			String phone = TestDataManager.getPhoneNum();
//
//			Logger.comment("绑定手机号，注册Apple账号");
//			loginBean = JUserCallService.initLoginBean();
//			loginBean.setThirdPartyType(ThirdPartyTypeEnum.Apple);
//			loginBean.setAppSource(AppSourceEnum.AppleApp);
//			loginBean.setMobile(phone);
//			loginBean.setDid("testChannelSource");
//			loginCall.setData(loginBean);
//			loginCall.callService();
//			String tid = loginBean.getThirdPartyId();
//			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
//			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
//			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
//
//			Logger.comment("和数据库进行数据校验");
//			verifyDB(uid, loginBean);
//			loginBean = new ThirdpartyLoginBean();
//			loginBean = JUserCallService.initLoginBean();
//			loginBean.setThirdPartyType(ThirdPartyTypeEnum.TouTiao);
//			loginBean.setAppSource(AppSourceEnum.TouTiaoMiniApp);
//			loginBean.setMobile(phone);
//			loginBean.setThirdPartyId(tid);
//			loginCall.setData(loginBean);
//			loginCall.callService();
//			Logger.comment("校验-uid不变");
//			Logger.verifyEquals(new BigDecimal(loginCall.getResult().get("UserId").toString()).intValue(), uid, "验证数据");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_060() {
		Logger.start(true, "百度BaiduMiniApp账号第一次授权,创建用户成功");
		try {
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");
			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.Baidu);
			loginBean.setAppSource(AppSourceEnum.BaiduMiniApp
					);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginCall.setData(loginBean);
			loginCall.callService();
			String tid = loginBean.getThirdPartyId();
			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_061() {
		Logger.start(true, "第三方name包含特殊字符");
		try {
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");
			loginBean = JUserCallService.initLoginBean();
			loginBean.setMobile(phone);
			loginBean.setThirdPartyUserName("Test😑😊😳");
			loginBean.setDid("testChannelSource");
			loginCall.setData(loginBean);
			loginCall.callService();
			loginCall.callService();
			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ThirdpartyLogin_062() {
		Logger.start(true, "不输入ThirdPartyId失败");
		try {
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();
			Logger.comment("绑定手机号，注册QQ账号");
			loginBean = JUserCallService.initLoginBean();
			loginBean.setMobile(phone);
			loginBean.setThirdPartyId("");
			loginBean.setDid("testChannelSource");
			loginCall.setData(loginBean);
			loginCall.callService();
			loginCall.callService();
			Logger.verifyEquals("400", loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", loginCall.getString("Success"), "验证是否成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	/**
	 * 创建压测数据 产线用
	 */
	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_ThirdpartyLogin_Test() {
		Logger.start(true,"创建压测数据");
		try {
			ExecutorService executor = new ThreadPoolExecutor(3, 3, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
			for (int i = 1; i < 10000; i++) {
				executor.submit(() -> {
					try {
						String tpid = "dy_"+TestDataManager.getRandomNum(10);
						String phone = "99"+TestDataManager.getRandomIntNum(9);
						String openid=TestDataManager.getRandomUUID().toString().replaceAll("-", "");
						String ip=TestDataManager.getRandomIp();
						ThirdpartyLoginBean loginBean2 = new ThirdpartyLoginBean();
						ThirdpartyLoginCall loginCall2=new ThirdpartyLoginCall();
						loginBean2=JUserCallService.initLoginBean();
						loginBean2.setOpenId(openid);
						loginBean2.setClientIp(ip);
						loginBean2.setThirdPartyType(ThirdPartyTypeEnum.TouTiao);
						loginBean2.setAppSource(AppSourceEnum.TouTiaoMiniApp);
						loginBean2.setMobile(phone);
						loginBean2.setThirdPartyId(tpid);
						loginCall2.setData(false,loginBean2);
						try {
							loginCall2.callService();
						} catch (IOException e) {
						}
						Logger.debug(loginCall2.getStatusCode());
					} catch (Exception e) {
					}
				});
			};
			int count = 300;
			while (!executor.isTerminated()) {
				Thread.sleep(1000);
				executor.shutdown();
				count--;
				if (count < 0) {
					executor.shutdownNow();
				}
			};
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	// AlipayMiniApp(36, "AlipayMiniApp", "支付宝小程序");
	public void Tc_ThirdpartyLogin_063() {
		Logger.start(true, "支付宝小程序AlipayMiniApp账号第一次授权,创建用户成功");
		try {
			String aliUserId = "ali_" + TestDataManager.getRandomNum(10);
			String phone = TestDataManager.getPhoneNum();

			Logger.comment("绑定手机号，注册QQ账号");
			loginBean = JUserCallService.initLoginBean();
			loginBean.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			loginBean.setAppSource(AppSourceEnum.AlipayMiniApp
					);
			loginBean.setMobile(phone);
			loginBean.setDid("testChannelSource");
			loginCall.setData(loginBean);
			loginCall.callService();
			String tid = loginBean.getThirdPartyId();
			Logger.verifyEquals(ECode.SUCCESS, loginCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", loginCall.getString("Success"), "验证是否成功");
			Integer uid = loginCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

			Logger.comment("和数据库进行数据校验");
			verifyDB(uid, loginBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}